#include <DLinkList.h>

// insert *s after *p
void Insert(DLinkList &DL, DNode &s) {
    // segment
    s->next = p->next;
    p->next = s;
    s->next->prior = s;
    s->prior = p;
}

// delete *q (next of *p)
void Delete(DLinkList &DL, DNode &p) {
    // segment
    DNode *q = p->next;
    q->next->prior = p;
    p->next = q->next;
    free(q);
}
